package com.assessment.servermanager.controller;

import com.assessment.servermanager.commen.controller.BaseController;
import com.assessment.servermanager.commen.entity.AjaxResult;
import com.assessment.servermanager.commen.entity.PageQuery;
import com.assessment.servermanager.commen.page.TableDataInfo;
import com.assessment.servermanager.entity.TbApprove;
import com.assessment.servermanager.entity.TbExam;
import com.assessment.servermanager.entity.bo.TbApproveBo;
import com.assessment.servermanager.entity.bo.TbExamBo;
import com.assessment.servermanager.entity.vo.TbApproveVo;
import com.assessment.servermanager.entity.vo.TbExamVo;
import com.assessment.servermanager.service.ITbApproveService;
import com.assessment.servermanager.service.ITbExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;


/**
 * 【考试申请表】Controller
 *
 * @author jiajia
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/exam")
public class TbExamController extends BaseController {
    @Autowired
    private ITbExamService tbExamService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    public TableDataInfo<TbExamVo> list(TbExamBo tbExamBo, PageQuery pageQuery) {
        return tbExamService.selectTbExamList(tbExamBo,pageQuery);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbExam tbExam) {
        /*List<TbApprove> list = tbApproveService.selectTbApproveList(tbApprove);
        ExcelUtil<TbApprove> util = new ExcelUtil<TbApprove>(TbApprove.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");*/
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(tbExamService.selectTbExamById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PostMapping
    public AjaxResult add(@RequestBody TbExam tbExam) {
        return toAjax(tbExamService.insertTbExam(tbExam));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TbExam tbExam) {
        return toAjax(tbExamService.updateTbExam(tbExam));
    }

    /**
     * 删除【请填写功能名称】
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(tbExamService.deleteTbExamByIds(ids));
    }
}
